package ru.cod.rs.exmpls.main.interfaces.impl.screens;

import java.util.List;

import ru.cod.rs.exmpls.main.abstractions.Assets;
import ru.cod.rs.exmpls.main.abstractions.Screen;
import ru.cod.rs.exmpls.main.interfaces.Game;
import ru.cod.rs.exmpls.main.interfaces.Graphics;
import ru.cod.rs.exmpls.main.interfaces.Input.TouchEvent;

public class MainMenuScreen extends Screen {

	public MainMenuScreen(Game game) {

		super(game);
	}

	@Override
	public void update(float deltaTime) {

		Graphics g = game.getGraphics();
		List<TouchEvent> touchEvents = game.getInput().getTouchEvents();
		game.getInput().getKeyEvents();
		int len = touchEvents.size();
		for (TouchEvent event : touchEvents) {
			if (event.type == TouchEvent.TOUCH_UP) {
				if (inBounds(event, 50, 50, 100, 100)) {
					game.setScreen(new HighScoreScreen(game));

				}

			}
		}
	}

	@Override
	public void present(float deltaTime) {

		Graphics g = game.getGraphics();
		g.drawPixmap(Assets.rectangle, 50, 50);

	}

	@Override
	public void pause() {

		// Settings.save(game.getFileIO());

	}

	@Override
	public void resume() {

		// TODO Auto-generated method stub

	}

	@Override
	public void dispose() {

		// TODO Auto-generated method stub

	}

	private boolean inBounds(TouchEvent event, int x, int y, int w, int h) {

		return (event.x > x && event.x < x + w - 1 && event.y > y && event.y < y
				+ h - 1);

	}
}
